nmbd is a server that understands and can reply to netbios name service requests, like those produced by LanManager clients. It also controls browsing.
LanManager clients, when they start up, may wish to locate a LanManager server. That is, they wish to know what IP number a specified host is using.
This program simply listens for such requests, and if its own name is specified it will respond with the IP number of the host it is running on. "Its own name" is by default the name of the host it is running on, but this can be overriden with the -n option (see "OPTIONS" below). Using the -S option (see "OPTIONS" below), it can also be instructed to respond with IP information about other hosts, provided they are locatable via the gethostbyname() call, or they are in a netbios hosts file.
Nmbd can also be used as a WINS (Windows Internet Name Server) server. It will do this automatically by default. What this basically means is that it will respond to all name requests that it receives that are not broadcasts, as long as it can resolve the name.
Only use this parameter if you are sure that the server cannot properly determine the proper broadcast address.
The default broadcast address is determined by the server at run time. If it encounters difficulty doing so, it makes a guess based on the local IP number.
-D
By default, the server will NOT operate as a daemon.
-C comment string
A %v will be replaced with the Samba version number.
A %h will be replaced with the hostname.
It defaults to "Samba %v".
-G
At startup, unless the -R switch has been used, the server will attempt to register all group names in the hosts file and on the command line (from the -G option).
The server will also respond to queries on this name.
-H
The file contains three columns. Lines beginning with a # are ignored as comments. The first column is an IP address, or a hostname. If it is a hostname then it is interpreted as the IP address returned by gethostbyname() when read. Any IP address of 0.0.0.0 will be interpreted as the servers own IP address.
The second column is a netbios name. This is the name that the server will respond to. It must be less than 20 characters long.
The third column is optional, and is intended for flags. Currently the only flags supported are G, S and M. A G indicates that the name is a group (also known as domain) name.
At startup all groups known to the server (either from this file or from the -G option) are registered on the network (unless the -R option has been selected).
A S or G means that the specified address is a broadcast address of a network that you want people to be able to browse you from. Nmbd will search for a master browser in that domain and will send host announcements to that machine, informing it that the specifed somain is available.
A M means that this name is the default netbios name for this machine. This has the same affect as specifying the -n option to nmbd.
After startup the server waits for queries, and will answer queries to any name known to it. This includes all names in the netbios hosts file (if any), it's own name, and any names given with the -G option.
The primary intention of the -H option is to allow a mapping from netbios names to internet domain names, and to allow the specification of groups that the server should be part of.
Example:
# This is a sample netbios hosts file
# DO NOT USE THIS FILE AS-IS
# YOU MAY INCONVENIENCE THE OWNERS OF THESE IPs
# if you want to include a name with a space in it then
# use double quotes.
# first put ourselves in the group LANGROUP
0.0.0.0 LANGROUP G
# next add a netbios alias for a faraway host
arvidsjaur.anu.edu.au ARVIDSJAUR
# finally put in an IP for a hard to find host
130.45.3.213 FREDDY
# now we want another subnet to be able to browse
# us in the workgroup UNIXSERV
192.0.2.255 UNIXSERV G
-M workgroup name
If you use the workgroup name "-" then nmbd will search for a master browser for any workgroup by using the name __MSBROWSE__.
This option is meant to be used interactively on the command line, not as a daemon or in inetd.
Only use this parameter if you are sure that the server cannot properly determine the proper netmask.
The default netmask is determined by the server at run time. If it encounters difficulty doing so, it makes a guess based on the local IP number.
-d debuglevel
debuglevel is an integer from 0 to 5.
The default value if this parameter is not specified is zero.
The higher this value, the more detail will be logged to the log files about the activities of the server. At level 0, only critical errors and serious warnings will be logged. Level 1 is a reasonable level for day to day running - it generates a small amount of information about operations carried out.
Levels above 1 will generate considerable amounts of log data, and should only be used when investigating a problem. Levels above 3 are designed for use only by developers and generate HUGE amounts of log data, most of which is extremely cryptic.
-l log file
The default base name is specified at compile time.
The base name is used to generate actual log file names. For example, if the name specified was "log", the following files would be used for log data:
log.nmb.in (containing inbound transaction data)
log.nmb.out (containing outbound transaction data)
The log files generated are never removed by the server.
-n netbios name
The default netbios name used if this parameter is not specified is the name of the host on which the server is running.
-p port number
port number is a positive integer value.
The default value if this parameter is not specified is 137.
This number is the port number that will be used when making connections to the server from client software. The standard (well-known) port number for the server is 137, hence the default. If you wish to run the server as an ordinary user rather than as root, most systems will require you to use a port number greater than 1024 - ask your system administrator for help if you are in this situation.
Note that the name server uses UDP, not TCP!
This parameter is not normally specified except in the above situation.
/etc/inetd.conf
/etc/rc.d/rc.inet2
If running the server as a daemon at startup, this file will need to contain an appropriate startup sequence for the server. See the section "Installation" below.
/etc/services
It is recommended that the server software be installed under the /usr/local hierarchy, in a directory readable by all, writeable only by root. The server program itself should be executable by all, as users may wish to run the server themselves (in which case it will of course run with their privileges). The server should NOT be setuid or setgid!
The server log files should be put in a directory readable and writable only by root, as the log files may contain sensitive information.
The remaining notes will assume the following:
log files stored in /var/adm/smblogs
The server may be run either as a daemon by users or at startup, or it may be run from a meta-daemon such as inetd upon request. If run as a daemon, the server will always be ready, so starting sessions will be faster. If run from a meta-daemon some memory will be saved and utilities such as the tcpd TCP-wrapper may be used for extra security.
When you've decided, continue with either "Running the server as a daemon" or "Running the server on request".
Any user can run the server as a daemon (execute permissions permitting, of course). This is useful for testing purposes.
To ensure that the server is run as a daemon whenever the machine is started, you will need to modify the system startup files. Wherever appropriate (for example, in /etc/rc.d/rc.inet2), insert the following line, substituting values appropriate to your system:
(The above should appear in your initialisation script as a single line. Depending on your terminal characteristics, it may not appear that way in this man page. If the above appears as more than one line, please treat any newlines or indentation as a single space or TAB character.)
If the options used at compile time are appropriate for your system, all parameters except the desired debug level and "-D" may be omitted. See the section on "Options" above.
First, ensure that a port is configured in the file /etc/services. The well-known port 137 should be used if possible, though any port may be used.
Ensure that a line similar to the following is in /etc/services:
Note for NIS/YP users: You may need to rebuild the NIS service maps rather than alter your local /etc/services file.
Next, put a suitable line in the file /etc/inetd.conf (in the unlikely event that you are using a meta-daemon other than inetd, you are on your own). Note that the first item in this line matches the service name in /etc/services. Substitute appropriate values for your system in this line (see inetd(8)):
(The above should appear in /etc/inetd.conf as a single line. Depending on your terminal characteristics, it may not appear that way in this man page. If the above appears as more than one line, please treat any newlines or indentation as a single space or TAB character.)
Note that there is no need to specify a port number here, even if you are using a non-standard port number.
To test whether the name server is running, start up a client on a different machine and see whether the desired name is now present. Alternatively, run the nameserver on a different machine specifying "-L netbiosname", where "netbiosname" is the name you have configured the test server to respond with. The command should respond with success, and the IP number of the machine using the specified netbios name. You may need the -B parameter on some systems. See the README file for more information on testing nmbd.
Most diagnostics issued by the server are logged in the specified log file. The log file name is specified at compile time, but may be overridden on the command line.
The number and nature of diagnostics available depends on the debug level used by the server. If you have problems, set the debug level to 3 and peruse the log files.
Most messages are reasonably self-explanatory. Unfortunately, at time of creation of this man page the source code is still too fluid to warrant describing each and every diagnostic. At this stage your best bet is still to grep the source code and inspect the conditions that gave rise to the diagnostics you are seeing.
This man page written by Karl Auer (Karl.Auer@anu.edu.au)
See smb.conf(5) for a full list of contributors and details on how to submit bug reports, comments etc.